<body leftmargin="0" rightmargin="0" topmargin="0">
<div style=" background: url(images/title-bg.jpg); height:64px; text-align:right;">
<img src="images/head.jpg">
</div>

<!--left menu start-->
<div style="float: left; width:180px; height:100%; margin-right:20px;">
<?
include "menu.inc.php";
?>
</div>
<!--left menu end-->

<!--Main start here-->
<form name="form" action="?act=save_role_menu" method="post" onSubmit="return GoSubmit(this)">
  <br>
  <table width="750" border="0" cellpadding="2" cellspacing="0" class="tableMainBodyFont">
    <tbody>
      <tr>
        <td width="3%" align="center" bgcolor="#aaaaaa" style=" border-top-style:solid;border-top-width:1px;"><strong>Kemaskini Menu bagi Peranan <i><?=$the_role->name?></i></strong></td>
      </tr>
    </tbody>
  </table>
  <table width="750" class="tableMainBodyFont">
    <tr>
      <td align="right">&nbsp;</td>
    </tr>
  </table>
  <table width="200" border="1" bgcolor="#dddddd" class="tableMainBodyFont" align="center">
    <tr style=" border-bottom-style:dashed; border-bottom-width:thin;">
      <th width="5%" align="center"><input type="checkbox" name="checkall" id="checkall" value="1" onClick="checkAll(this.form)"></th>
      <th width="15%">Menu </th>
    </tr>
    <?
	$bil = 0;
    while ($menu = pg_fetch_object($menus)) {
		$checked = (in_array($menu->id,$role_menus))? "checked":"";
		$bil++;
    ?>
    <tr align="center" id="<?="row_$i"?>">
      <td align="center"><input type="checkbox" name="menu_ids[]" value="<?=$menu->id?>" <?=$checked?>></td>
      <td align="left" class="<? echo ($menu->is_parent=='t')?"tablenavigationHeader":"tablenavigationTD";?>">&nbsp;
        <?=$menu->caption?></td>
    </tr>
    <?
	  }
	  ?>
  </table>

  <br>
  <table width="200" class="tableMainBodyFont" align="center">
    <tr>
      <td align="center"><input type="reset" name="reset" value="Reset" class="button">
      <input type="submit" name="Submit" value="Simpan" class="button">
      <input name="role_id" value="<?=$the_role->id?>" type="hidden" /></td>
    </tr>
  </table>
</form>

<!--Main end here-->
</body>
<script>
function GoSubmit(df) {
	
	if (!checkInput(icnumRegExp,document.getElementById('ic_new'),'No Kad Pengenalan Baru')) return false;
	//if (!checkInput(anythingRegExp,$('name'),'Nama Staf')) return false;
	//if (!checkSelection(strRegExp,document.getElementById('gender'),'Jantina')) return false;
	return true;
}

//document.forms[0].onsubmit = GoSubmit;

</script>

<script>
msg = '<? echo ($m!='')?"1":"";?>';
if (msg!='') alert('Polisi Berjaya Dikemaskini'); 
</script>

<script>
function checkAll(df) {
  for (i=1; i<df.elements.length; i++ )
  {
     if (df.elements[i].type == "checkbox")
     {
       df.elements[i].checked = df.checkall.checked
     } 
  }
  
}

function confirmDelete(userid) {
	if(confirm("Adakah anda pasti?")) {
		location = '?act=destroy_role&id=' + userid;
	}
	else return;
}


</script>

<?
alert_some_message();
?>

